home *** CD-ROM | disk | FTP | other *** search
- /\ RKCP /\
- \/ RKCP \/
-
- *******************************************************************
- ************************ FILE1 by Rex Kerr ************************
- ************************ Copyright (C) 1989 ***********************
- *******************************************************************
-
- FILE1 is a TP5 unit that performs various operations on files.
-
- I wrote it after I had just written a "copyfile" procedure from
- scratch for the fifth time for use in one of my many file-using
- programs. Then I realized that I didn't have to keep writing it
- over and over and over again. I wrote just one and put it in a unit.
- But I was also writing a function called "existfile" over and over.
- So I added that as well.
-
- So I wrote the unit. But that wasn't enough to make up a unit all
- by itself. So I added three more procedures: RenameFile, EraseFile
- and TypeFile. Here they are:
-
- ***
-
- ExistFile(st : pathstr) : boolean;
-
- This returns true if the file in st exists; otherwise it returns
- false.
-
- ***
-
- CopyFile(fromfile,tofile : pathstr; var result : byte);
-
- This copies the file specified in fromfile to the one specified
- in tofile. The result bytes returns 0 if the operation was
- succesful. If not, it will return one of these error codes:
- 1 : File to copy from does not exist as specified
- 2 : File to copy to already exists as specifed (FILE1 won't
- overwrite existing files.)
- 3 : Heap too small to create file copy buffer (FILE1 needs
- at least 1k of heap, and will use up to 32k, if it is
- available.)
-
- ***
-
- RenameFile(fromfile,tofile : pathstr; var result : byte);
-
- This renames the file in fromfile to the name in tofile. The result
- byte returns 0 if it is successful. Otherwise, it returns one of
- the non-zero error codes shown below:
- 1 : File to rename does not exist
- 2 : Name to rename to already exists
-
- ***
-
- EraseFile(delfile : pathstr; var result : byte);
-
- EraseFile erases the file named in delfile. The result byte returns
- 0 if it is succesful. If not, it returns one of the below error
- codes:
- 1 : File does not exist to erase
-
- ***
-
- TypeFile(showfile : pathstr; var result : byte);
-
- This types the file named in showfile to the current TP5 window on
- the screen. While it is typing the file out, if any key is pressed,
- it will stop and wait until another key is pressed. When it is,
- the writing to the screen will continue. If ESC is pressed at any
- time during the type, the procedure will end. If typing is
- succesfully started, the result byte will contain 0. Otherwise, it
- will contain one of the error codes shown below:
- 1 : File to type does not exist
- 2 : Heap too small (TypeFile also needs at least 1k of heap,
- it will use up to 32k if that much is available.)
-
- ***
-
- That's everything. I don't think I need to give any further
- explination of them, but if you think I've left something out,
- or if anything is unclear, please contact me on either EasyPlex
- or the TP5 messages section of BPROGA (both on CompuServe).
-
- Rex Kerr 71550,3147
-
- /\ RKCP /\
- \/ RKCP \/